﻿using System;

namespace Douya.Json
{
    public class JsonBoolean : IJsonValue
    {
        bool value;

        public JsonBoolean(bool value)
        {
            this.value = value;
        }

        public ValueType Type
        {
            get { return ValueType.TypeBoolean; }
        }

        public bool GetBoolean()
        {
            return value;
        }

        public int GetInteger()
        {
            return value ? 1 : 0;
        }

        public string GetString()
        {
            return value ? "true" : "false";
        }

        public JsonObject GetObject()
        {
            return null;
        }

        public JsonArray GetArray()
        {
            return null;
        }

        public override string ToString()
        {
            return GetString();
        }
    }
}
